package developer.zyk.ability.knowledge.common;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @author zhangyongkang
 * @time 2025/5/15 15:48
 * @description
 */

@AllArgsConstructor
@Getter
public enum KnowledgeUploadStatus {
    INIT(0, "init", "初始化", true),
    START(1, "start", "开始处理", false),
    HANDLE(2, "embedding", "嵌入处理中", false),
    EMBEDDING_SUCCESS(3, "embedding_success", "解析完成", false),
    EMBEDDING_FAILED(4, "embedding_failed", "解析失败", true),
    VECTOR_STORED_ACCEPT(5, "vector_stored_accept", "已采纳", false),
    ;
    private final int sort;
    private final String code;
    private final String name;
    private final Boolean enableParse;//是否可以被重新解析

    public static KnowledgeUploadStatus queryByCode(String code) {
        for (KnowledgeUploadStatus value : values()) {
            if (Objects.equals(code, value.getCode())) {
                return value;
            }
        }
        throw new UnsupportedOperationException("未知的状态码:" + code);
    }
}
